package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class 四平方和 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       static int a[]=new int[4],n,idx;
       
       public static void main(String[] args) throws NumberFormatException, IOException {
		      n=Integer.parseInt(br.readLine());
		      for(int a=0;a*a<=n;a++)
		    	  for(int b=a;a*a+b*b<=n;b++)
		    		  for(int c=b;a*a+b*b+c*c<=n;c++){
		    			  int t=n-a*a-b*b-c*c;
		    			  int d=(int)Math.sqrt(t);
		    			  if(d*d==t){
		    				  System.out.print(a+" "+b+" "+c+" "+d);
		    				  return;
		    			  }
		    		  }
	}
}
